<?php
/**
 * Minhlog Minh_Resource 邮件资源类
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 *
 * @category   Minh
 * @package    Minh_Resource
 * @copyright  Copyright (c) 2009-2010 Minh.Shu Minh.Shu@gmail.com
 * @license    New BSD License
 * @author     Minh.Shu
 * @version    $Id: Mail.php 37 2010-05-10 16:20:47Z Minh.Shu $
 *
 */
class Minh_Resource_Mail extends Zend_Application_Resource_ResourceAbstract
{
    /**
     * 邮件资源
     * @access private
     * @var object
     */
    private $_mail;

    /**
     * 初始化方法
     * @return void
     */
    public function init ()
    {
        return $this->_getMail();
    }

    /**
     * 获取邮件资源对象
     * @access private
     * @return $mail
     */
    private function _getMail ()
    {
        if (null === $this->_mail) {
            $options = $this->getOptions();
            $mailTransport = new Zend_Mail_Transport_Smtp($options['smtp']['server'], $options['config']);
            Zend_Mail::setDefaultTransport($mailTransport);
            $this->_mail = $options;
        }
        return $this->_mail;
    }
}